package exercise.day07;

import java.util.Random;
import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Random rand = new Random();
        int guess1 = rand.nextInt(100);
        while (true) {
            System.out.println("猜吧！");
            int num1 = scan.nextInt();
            if (num1 > guess1) {
                System.out.println("猜大了");
            } else if (num1< guess1) {
                System.out.println("猜小了");
            } else {
                System.out.println("恭喜你答对了");
                break;
            }


            int guess = (int) (Math.random() * 100);
            while (true) {
                System.out.println("猜吧！");
                int num = scan.nextInt();
                if (num > guess) {
                    System.out.println("猜大了");
                } else if (num < guess) {
                    System.out.println("猜小了");
                } else {
                    System.out.println("恭喜你答对了");
                    break;
                }

            }
        }
    }

}
